<?php
require_once 'Request/Request.php';
require_once dirname(__FILE__) . '/../Components.php';
require_once APPLICATION_PATH . '/models/Names/Names.php';

class Components_YMapCtrl extends Components
{
	const TEMPLATE_NAME_ADD = 'YMapCtrl.tpl';
	const TEMPLATE_NAME_CHG = 'YMapChgCtrl.tpl';

	/** NAME属性：ＦＯＲＭ */
	protected $_sFormName;

	public function __construct($sCompileId, $sFormName="")
	{
		parent::__construct(dirname(__FILE__), $sCompileId);
		$this->_sFormName = $sFormName;
		$this->view->NAME_INPUT_YMAP_URL = Names::ASSEMBLYYMAPLINK;
		$this->view->NAME_INPUT_ASSEMBLEPLACE = Names::ASSEMBLYPLACE;

		$objHttpRequest = new Lib_Request();
		$this->view->VALUE_INPUT_YMAP_URL
		= $objHttpRequest->get(Names::ASSEMBLYYMAPLINK);
		$this->view->VALUE_INPUT_ASSEMPLEPLACE
		= $objHttpRequest->get(Names::ASSEMBLYPLACE);
	}

	public function fetch($editFlag='')
	{
		if ( $this->_sFormName != '' ) {
			$this->view->FormName = $this->_sFormName;
		}
		$this->view->CHANGE_REQUEST = $editFlag;
		if ($editFlag == '') {
			$sHtml = parent::fetch(self::TEMPLATE_NAME_ADD);
		} else {
			$sHtml = parent::fetch(self::TEMPLATE_NAME_CHG);
		}
		return $sHtml;
	}
}